<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <title>修改头像</title>
  <%@include file="/WEB-INF/jsp/public/commons.jspf"%>
  <script type="text/javascript">
  $(function() {  
    /*原理是把本地图片路径："D(盘符):/image/..."转为"http://..."格式路径来进行显示图片*/  
    $("#fileupload").change(function() {  
        var $file = $(this);  
        var objUrl = $file[0].files[0];  
        //获得一个http格式的url路径:mozilla(firefox)||webkit or chrome  
        var windowURL = window.URL || window.webkitURL;  
        //createObjectURL创建一个指向该参数对象(图片)的URL  
        var dataURL;  
        dataURL = windowURL.createObjectURL(objUrl);  
        $("#imageview").attr("src",dataURL);  
    });  
});  
</script>
  </head>
  
  <body>
 	<form action="personal_updatephoto.action" method="post" enctype="multipart/form-data">
		<div id="photo">
		<table class="col-sm-8 col-sm-offset-2">
			<tr>
				<td class="col-sm-4"><img src="${pageContext.request.contextPath}${session.user.photo}" class="img-circle" style="width: 95" ></td>
				<td class="col-sm-4">=====></td>
				<td class="col-sm-4"><img src="${pageContext.request.contextPath}/images/head.png" id="imageview" class="img-circle" style="width: 95"></td>
			</tr>
			<tr><td><br></td></tr>
			<tr>
				<td class="col-sm-4"></td>
				<td class="col-sm-4"><input id="fileupload" name="file" type="file" value="上传头像" data-overwrite-initial="false" data-min-file-count="1" data-max-file-count="1"/></td>
				<td class="col-sm-4"></td>
			</tr>
			<tr><td><br></td></tr>
			<tr>
				<td class="col-sm-4"></td>
				<td class="col-sm-4"></td>
				<td class="col-sm-4"><input type="submit" class="btn btn-default" value="保存修改" ></td>
			</tr>
		</table>
		</div>
	</form>
  </body>
</html>
